package com.faeple.admin.dao.sqlmap;

import java.util.HashMap;
import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.faeple.admin.dao.AdminDao;
import com.faeple.common.entity.InquiryDto;
import com.faeple.log.entity.LogHackDto;
import com.faeple.log.entity.LogLoginLogoutDto;
import com.faeple.post.entity.CommentDto;
import com.faeple.post.entity.PostDto;
import com.faeple.user.entity.UserDto;

@Repository
public class SqlMapAdminDao implements AdminDao {

	@Autowired
	private SqlSession sqlSession;
	
	@Override
	public List<UserDto> getTodayLoginMember() {
		return sqlSession.selectList("AdminMapper.getTodayLoginMember");
	}

	@Override
	public List<UserDto> getTodaySignupMember() {
		return sqlSession.selectList("AdminMapper.getTodaySignupMember");
	}

	@Override
	public List<HashMap<String, String>> getTodayLeaveMember() {
		return sqlSession.selectList("AdminMapper.getTodayLeaveMember");
	}

	@Override
	public List<PostDto> getTodayUploadPost() {
		return sqlSession.selectList("AdminMapper.getTodayUploadPost");
	}

	@Override
	public List<CommentDto> getTodayAddComment() {
		return sqlSession.selectList("AdminMapper.getTodayAddComment");
	}

	@Override
	public List<HashMap<String, String>> getTodayAddTag() {
		return sqlSession.selectList("AdminMapper.getTodayAddTag");
	}

	@Override
	public int getTotalMemberCount() {
		return sqlSession.selectOne("AdminMapper.getTotalMemberCount");
	}

	@Override
	public int getTotalPostCount() {
		return sqlSession.selectOne("AdminMapper.getTotalPostCount");
	}

	@Override
	public int getTotalNoticeCount() {
		return sqlSession.selectOne("AdminMapper.getTotalNoticeCount");
	}

	@Override
	public List<UserDto> getMemberList(HashMap<String, Object> param) {
		return sqlSession.selectList("AdminMapper.getMemberList", param);
	}

	@Override
	public List<PostDto> getPostList(HashMap<String, Object> param) {
		// TODO Auto-generated method stub
		return sqlSession.selectList("AdminMapper.getPostList", param);
	}

	@Override
	public List<LogLoginLogoutDto> getLogLogin(HashMap<String, Object> param) {
		return sqlSession.selectList("AdminMapper.getLogLoginList", param);
	}

	@Override
	public int getSearchTotalLoginLog(HashMap<String, Object> param) {
		return sqlSession.selectOne("AdminMapper.getSearchTotalLoginLog", param);
	}

	@Override
	public int getTotalLogHack(HashMap<String, Object> param) {
		return sqlSession.selectOne("AdminMapper.getTotalLogHack", param);
	}

	@Override
	public List<LogHackDto> getLogHackList(HashMap<String, Object> param) {
		return sqlSession.selectList("AdminMapper.getLogHackList", param);
	}

	@Override
	public List<HashMap<String, String>> getNoticeList(HashMap<String, String> param) {
		return sqlSession.selectList("AdminMapper.getNoticeList", param);
	}

	@Override
	public HashMap<String, String> getNotice(int idx) {
		return sqlSession.selectOne("AdminMapper.getNotice",idx);
	}

	@Override
	public int noticeWrite(HashMap<String, String> param) {
		return sqlSession.insert("AdminMapper.noticeWrite", param);
	}

	@Override
	public int noticeUpdate(HashMap<String, String> param) {
		return sqlSession.update("AdminMapper.noticeUpdate", param);
	}

	@Override
	public int noticeDelete(int idx) {
		return sqlSession.delete("AdminMapper.noticeDelete",idx);
	}

	@Override
	public int getTotalInquiry() {
		return sqlSession.selectOne("AdminMapper.getTotalInquiry");
	}

	@Override
	public List<InquiryDto> getInquiryList(HashMap<String, Object> param) {
		return sqlSession.selectList("AdminMapper.getInquiryList", param);
	}

	@Override
	public int getSearchTotalInquiry(HashMap<String, Object> param) {
		return sqlSession.selectOne("AdminMapper.getSearchTotalInquiry", param);
	}

	@Override
	public InquiryDto getInquiry(int idx) {
		return sqlSession.selectOne("AdminMapper.getInquiry", idx);
	}

	@Override
	public int inquiryReply(HashMap<String, String> param) {
		return sqlSession.update("AdminMapper.inquiryReply", param);
	}

	@Override
	public int getTotalFeedback() {
		return sqlSession.selectOne("AdminMapper.getTotalFeedback");
	}

	@Override
	public List<HashMap<String, String>> getFeedbackList(HashMap<String, Object> param) {
		return sqlSession.selectList("AdminMapper.getFeedbackList", param);
	}

	@Override
	public int getSearchTotalFeedback(HashMap<String, Object> param) {
		return sqlSession.selectOne("AdminMapper.getSearchTotalFeedback", param);
	}

	@Override
	public int getTotalBug() {
		return sqlSession.selectOne("AdminMapper.getTotalBug");
	}

	@Override
	public List<HashMap<String, String>> getBugList(HashMap<String, Object> param) {
		return sqlSession.selectList("AdminMapper.getBugList", param);
	}

	@Override
	public int getSearchTotalBug(HashMap<String, Object> param) {
		return sqlSession.selectOne("AdminMapper.getSearchTotalBug", param);
	}

	@Override
	public int getTodayHelpCnt() {
		return sqlSession.selectOne("AdminMapper.getTodayHelpCnt");
	}

	@Override
	public int getSearchTotalPost(HashMap<String, Object> param) {
		return sqlSession.selectOne("AdminMapper.getSearchTotalPost", param);
	}

	@Override
	public int getSearchTotalMember(HashMap<String, Object> param) {
		return sqlSession.selectOne("AdminMapper.getSearchTotalMember", param);
	}

	@Override
	public int getTotalLogLoginCount() {
		return sqlSession.selectOne("AdminMapper.getTotalLogLoginCount");
	}

	@Override
	public int getAndroidGcmTotalCnt() {
		return sqlSession.selectOne("AdminMapper.getAndroidGcmTotalCnt");
	}

	@Override
	public int getTodayAndroidGcmTotalCnt() {
		return sqlSession.selectOne("AdminMapper.getTodayAndroidGcmTotalCnt");
	}

	@Override
	public List<HashMap<String, String>> gcmUserSearch(String value) {
		return sqlSession.selectList("AdminMapper.gcmUserSearch", value);
	}

	@Override
	public List<String> getGcmRegidAll() {
		return sqlSession.selectList("AdminMapper.getGcmRegidAll");
	}

	@Override
	public int getTodayLoginMemberCnt() {
		return sqlSession.selectOne("AdminMapper.getTodayLoginMemberCnt");
	}

	@Override
	public int getTodaySignupMemberCnt() {
		return sqlSession.selectOne("AdminMapper.getTodaySignupMemberCnt");
	}

	@Override
	public int getTodayLeaveMemberCnt() {
		return sqlSession.selectOne("AdminMapper.getTodayLeaveMemberCnt");
	}

	@Override
	public int getTodayUploadPostCnt() {
		return sqlSession.selectOne("AdminMapper.getTodayUploadPostCnt");
	}

	@Override
	public int getTodayAddCommentCnt() {
		return sqlSession.selectOne("AdminMapper.getTodayAddCommentCnt");
	}

	@Override
	public int getTodayAddTagCnt() {
		return sqlSession.selectOne("AdminMapper.getTodayAddTagCnt");
	}

	@Override
	public int deleteMember(String idx) {
		return sqlSession.delete("AdminMapper.deleteMember", idx);
	}

	@Override
	public UserDto getMember(String idx) {
		return sqlSession.selectOne("AdminMapper.getMember",idx);
	}

}
